package com.tanhua.server.controller;

import com.tanhua.model.vo.PageResult;
import com.tanhua.model.vo.RecommendUserVo;
import com.tanhua.model.vo.TodayBestVo;
import com.tanhua.server.service.TanHuaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.Path;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/tanhua")
public class TanHuaController {

    @Autowired
    private TanHuaService tanHuaService;

    /**
     * 今日佳人
     * @return
     */
    @GetMapping("/todayBest")
    public ResponseEntity todayBest(){
        TodayBestVo todayBest = tanHuaService.todayBest();
        return ResponseEntity.ok(todayBest);
    }

    /**
     * 推荐朋友
     * @return
     */
    @GetMapping("/recommendation")
    public ResponseEntity recommendation(RecommendUserVo recommendUserVo){
        PageResult<TodayBestVo> pageResult = tanHuaService.recommendation(recommendUserVo);
        return ResponseEntity.ok(pageResult);
    }

    /**
     * 佳人信息
     * @return
     */
    @GetMapping("/{id}/personalInfo")
    public ResponseEntity getPersonalInfo(@PathVariable("id") Long userId){
        TodayBestVo todayBestVo = tanHuaService.getPersonalInfo(userId);
        return ResponseEntity.ok(todayBestVo);
    }

    /**
     * 查询陌生人问题
     * @return
     */
    @GetMapping("/strangerQuestions")
    public ResponseEntity strangerQuestions(Long userId){
        String content = tanHuaService.strangerQuestions(userId);
        return ResponseEntity.ok(content);
    }

    /**
     * 回复陌生人问题
     * @return
     */
    @PostMapping("/strangerQuestions")
    public ResponseEntity replyStrangerQuestions(@RequestBody Map<String,String> param){
        tanHuaService.replyStrangerQuestions(param);
        return ResponseEntity.ok(null);
    }

    /**
     * 探花推荐列表查询
     * @return
     */
    @GetMapping("/cards")
    public ResponseEntity cards(){
        List<TodayBestVo> pageResult = tanHuaService.cards();
        return ResponseEntity.ok(pageResult);
    }


}
